#include <bits/stdc++.h>
using namespace std;

void solve() {
    int n;
    cin >> n;
    vector<int>a(n + 1);
    for(int i = 1; i <= n; i++) cin >> a[i];
    for(int i = 1; i < n; i++) {
        if(a[i] != i && (abs(a[i + 1] - a[i]) == 1)){
            swap(a[i], a[i + 1]);
        }
        if(a[i] != i) {
            cout << "NO\n";
            return;
        }
    }
    if(a[n] != n) cout << "NO\n";
    else cout << "YES\n";
}

int main() {
    int t;
    cin >> t;
    while(t--) solve();
    return 0;
}